package com.coda.app.mapper;

import com.coda.app.annotation.AutoFill;
import com.coda.appVo.appointment.AppointmentItemVo;
import com.coda.entity.ViewAppointment;
import com.coda.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ViewAppointmentMapper {
    /**
     * 新增看房预约
     * @param viewAppointment
     */
    @AutoFill(OperationType.INSERT)
    void insert(ViewAppointment viewAppointment);

    /**
     * 跟新看房预约
     * @param viewAppointment
     */
    @AutoFill(OperationType.UPDATE)
    void update(ViewAppointment viewAppointment);

    /**
     * 查询所有预约
     * @return
     */
    @Select("select * from view_appointment where user_id = #{user_id}")
    List<ViewAppointment> getList(Long userId);

    /**
     * 根据id获取看房信息
     * @param id
     * @return
     */
    @Select("select * from view_appointment where id = #{id}")
    ViewAppointment getById(Long id);
}
